home *** CD-ROM | disk | FTP | other *** search
- Path: li.net!sbda
- From: sbda@newshost.li.net (sbda)
- Newsgroups: comp.lang.c
- Subject: Re: Newbie Q: Arrays > 64K?
- Date: 17 Feb 1996 19:16:06 GMT
- Organization: LI Net (Long Island Network)
- Distribution: world
- Message-ID: <4g59hm$k60@linet06.li.net>
- References: <4f3ajc$oud@earth.superlink.net> <4f3daf$46g@sparcserver.lrz-muenchen.de>
- NNTP-Posting-Host: linet01.li.net
- X-Newsreader: TIN [version 1.2 PL2]
-
- Kurt Watzka (ua302aa@sun2.lrz-muenchen.de) wrote:
- : rizzom@superlink.net writes:
-
- : >Hi,
-
- : > I am using Turbo C++ 3.0 in DOS. I would just like to know
- : >how to declare an array that is larger than 64K. I have tried
- : >all of the memory models available and still get an error
-
- : You cannot portably have object with sizes greater than 32k in
- : C. So obviously, your compiler does not have a problem when it
- : gives you an error message for arrays larger than 64k.
-
- : You could
-
- : 1) Modify your data structure so that no object is larger than
- : 32k (The size of one "VMProc" should be less than 2k on
- : most machines, so an array of pointers to VMProc should
- : be possible on most machines, working somehow like this:)
-
- : VMProc *proc[64];
-
- : for (i = 0; i < 64; i+= 16) {
- : VMProc *tmp = calloc(16, sizeof(VMProc));
- : if (tmp == NULL)
- : /* Handle error condition */
- : for (j = 0; j < 16, j++)
- : proc[i + j] = tmp + j;
- : }
-
- : You have to check my assumption about the size of a VMProc
- : on your machine, using your implementation.
-
- : 2) Consider using an operating system that allows you to
- : use larger objects and forget about portability.
-
- : Kurt
- : --
- : | Kurt Watzka Phone : +49-89-2180-6254
- : | watzka@stat.uni-muenchen.de
- : | ua302aa@sunmail.lrz-muenchen.de
-
-
-
- If you are using Turbo C 3.0 for DOS and need do declare an array larger
- than 64K - there are several ways to do it. The easiest is the huge modifier.
-
- Example: 100,000 byte character array
-
- char huge x[100000L];
-
-